home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Easiest way to center a string?
- Date: Thu, 22 Feb 96 23:50:30 GMT
- Organization: none
- Distribution: world
- Message-ID: <825033030snz@genesis.demon.co.uk>
- References: <Pine.A32.3.91.960221155136.193887A@red.weeg.uiowa.edu>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <Pine.A32.3.91.960221155136.193887A@red.weeg.uiowa.edu>
- robinson@blue.weeg.uiowa.edu "The Amorphous Mass" writes:
-
- >On 22 Feb 1996, Simon Hosie wrote:
- >
- >> Simon Hosie:
- >> > printf("%*s\n", (strlen(String - LineLen) / 2, String);
- >> Simon Hosie:
- >> > Sorry, make that:
- >> > printf("%*s\n", (strlen(String + LineLen)) / 2, String);
- >>
- >> If this one is wrong I'm not correcting myself again, I promise (I haven't
- >> been getting enough sleep, ok?)..
- >>
- >> printf("%*s\n", (strlen(String) + LineLen) / 2, String);
- >
- > Since I have managed to make a complete fool out of myself on this
- >thread previously (thanks to Tanmoy and Lawrence for being so indulgent,
-
- Indulgent? Public humiliation is usually far more effective than
- simple flaming! ;-)
-
- >and my apologies to Simon for being completely wrong in my critique), I will
- >think this response through _very_ carefully. As Lawrence pointed out,
- >you need to cast that expression to int, because printf() expects an int
- >and not a size_t (which might not fit into an int). So use
- >
- > printf("*s\n", (int)((strlen(String) + LineLen) / 2), String);
-
- ^
- I think a % here would help! :-))
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-